import request from '@/utils/request';

const cartBaseURL = '/cart'

    /**
     * 查看购物车详情
     * @return cartData
     * private Date created;
     * private Map<Long, CartItem> itemMap;包含购物车中所有商品项的map
     */
export function getCartDetail(params){
    return request({
        url: cartBaseURL+'/getCartDetail',
        method: 'get',
        params
    })
}

    /**
     * 加入购物车
     * @param command
     * private Long itemId;
     * private String itemName;
     * private String number;
     * private String image;
     * @return
     */
export function addItemToCart(params){
    return request({
        url: cartBaseURL+'/addItemToCart',
        method: 'post',
        params
    })
}

    /**
     * 移除商品
     * @param itemId
     * @return
     */
export function removeItemFromCart(params){
    return request({
        url: cartBaseURL+'/removeItemFromCart',
        method: 'post',
        params
    })
}

    /**
     * 结算购物车
     * @return
     */
export function settleCart(params){
    return request({
        url: cartBaseURL+'/settleCart',
        method: 'post',
        params
    })
}